#ifndef ABSORD_H
#define ABSORD_H

#include "./Constants.h"
class Absord{
    
public:
    void operator()(double* absord_array, int len_ab){
        double x0 = 0.;
        double xn = len_ab - 1.;
        double l = 2. * xn;
        for (int i = 0; i < len_ab; i++)
        {
            double xi = x0 + i;
            absord_array[i] = std::pow(cos(PI * (fabs(xi - x0)/(l - 2. * x0))), 1./8.);
        }
    }
    
    void h(double*absord_array, int len_ab){

        double a = std::log(1e3)/(len_ab/2.);
        double b = len_ab / 2.;
        for(int i = 0; i < len_ab; i++){
            absord_array[i] = 1./(1. + std::exp(a *(i * 1. - b)));
        }
    }
};

#endif

// void operator()(double* absord_array, int len_ab, double* x_array, int len_x){
//         double x0 = x_array[len_x - len_ab - 1];
//         double xn = x_array[len_x - 1];
//         double l = 2. * xn;
//         for (int i = 0; i < len_ab; i++)
//         {
//             double xi = x_array[len_x - len_ab + i];
//             absord_array[i] = std::pow(cos(PI * (fabs(xi - x0)/(l - 2. * x0))), 1./8.);
//         }
//     }